<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<%@include file="/common/admin_common.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>专题管理</title>
		<script type="text/javascript" src="${ctx}/js/page.js"></script>
		<link type="text/css" rel="stylesheet"
			href="${ctx }/ckeditor/_samples/sample.css" />
		<script type="text/javascript">
			function sub(){
			
		         var title = document.getElementById('title').value;
                 if(title==""||title==null){
                     alert("请输入专题标题。");
                     document.articleForm.title.focus();
                     return false;
                 }

                 var keywords=document.getElementById('keywords').value;
                 if(keywords==""||keywords==null){
                     alert("请输入专题关键字。");
                     document.articleForm.keywords.focus();
                     return false;
                 }
                 var author=document.getElementById('describe').value;
                if(author==null||author==""){
                    alert("请输入专题描述。");
                    document.articleForm.author.focus();
                    return false;
                }
                return true;
		    }
		</script>
	</head>
	<body style="background-image: none;">

		<div class="content-box">
			<!-- Start Content Box -->
			<div class="content-box-header">
				<h3>
					文章管理
				</h3>
				<ul class="content-box-tabs">
					<li>
						<a href="#tab1" class="default-tab">文章信息列表</a>
					</li>
					<!-- href must be unique and match the id of target div -->
					<li>
						<a href="#tab2">发表专题</a>
					</li>
				</ul>
				<div class="clear"></div>
			</div>
			<!-- End .content-box-header -->
			<div class="content-box-content">
				<div class="tab-content default-tab" id="tab1">
					<s:action name="getArticleList" namespace="/admin"></s:action>
					<!-- This is the target div. id must match the href of this div's tab -->
					<div class="notification attention png_bg">
						<a href="#" class="close"><img
								src="${ctx}/images/icons/cross_grey_small.png"
								title="Close this notification" alt="close" /> </a>
						<div>
							<form action="${ctx}/admin/article/searchby" method="get">
								<input type="hidden" name="currentPage" value="1">
								导航名
								<select style="width: 140px" id="navid2" name="navid"></select>
								时间
								<input type="text" name="pubtime" />
								关键字
								<input type="text" value="${keyword}" name="keyword" />
								<input type="submit" value="查询" />
								<input type="button" value="查询全部" onclick="searchAll()" />
							</form>
						</div>
					</div>
					<table class="table">

						<thead class="thead">
							<tr>
								<th>
									<input class="check-all" type="checkbox" />
								</th>
								<th>
									序号
								</th>
								<th>
									文章标题
								</th>
								<th>
									关键字
								</th>
								<th>
									文章描述
								</th>
								<th>
									创建时间
								</th>
								<th>
									操作
								</th>
							</tr>

						</thead>

						<tfoot>

							<tr>
								<td colspan="7">
									<br />
									<div class="bulk-actions align-left">
										<a class="button" href="javascript:delByIds('${ctx}');">删除选定</a>
									</div>
									<!-- 分页信息 -->
									<div class="pagination">
										<c:if test="${pm.result ne null}">
											<script>
													var pg = new showPages('pg');
													pg.pageCount = ${pm.maxPage};
													pg.argName = 'currentPage';
													pg.printHtml();  
												</script>
										</c:if>
									</div>
									<!-- End .pagination -->
									<div class="clear"></div>
								</td>
							</tr>
						</tfoot>
						<!-- 数据展示 -->
						<tbody id="datalist">
							<c:choose>
								<c:when test="${pm.result eq null}">
									<tr>
										<td colspan="7">
											没有文章分类信息，请先添加
										</td>
									</tr>
								</c:when>
								<c:otherwise>
									<c:forEach var="article" items="${pm.result}"
										varStatus="status">
										<tr id="${article.articleId}">
											<td>
												<input type="checkbox" name="xidx"
													value="${article.articleId}" />
											</td>
											<td>
												${status.index+1}
											</td>
											<td>
												${fn:substring(article.articleTitle,0,10)}
											</td>
											<td>
												${fn:substring(article.articleKeywords,0,4)}
											</td>
											<td>
												${fn:substring(fht:delHTMLTag(article.articleContent),0,12)}...
											</td>
											<td>
												<fmt:formatDate value="${article.articleCreateTime}"
													pattern="yyyy/MM/dd" />
											</td>
											<td>
												<!-- Icons -->
												<a href="javascript:delById('${ctx}',${article.articleId});"
													title="删除文章分类信息"><img
														src="${ctx}/images/icons/cross.png" alt="删除文章分类信息" /> </a>
												<a href="javascript:edit('${ctx}',${article.articleId})"
													title="修改文章分类信息"><img
														src="${ctx}/images/icons/hammer_screwdriver.png"
														alt="修改文章分类信息" /> </a>
											</td>
										</tr>
									</c:forEach>
								</c:otherwise>
							</c:choose>

						</tbody>

					</table>
				</div>
				<!-- End #tab1 -->
				<div class="tab-content" id="tab2">
					<s:action name="getArticleType" namespace="/admin"></s:action>
					<s:action name="getArticleStyle" namespace="/admin"></s:action>
					<form name="articleForm" action="adminTopicIssue" method="post"
						enctype="multipart/form-data" onsubmit="return sub()">
					
						<p>
							<label style="color: red;">
								专题标题：
							</label>
							<input class="text-input small-input" type="text" id="title"
								name="title" />
							&nbsp;&nbsp;
							<span class="input-notification attention png_bg">输入专题的标题信息</span>
							<br />
						</p>
						<p>
							<label>
								关键字：
							</label>
							<input class="text-input Medium-input" type="text" id="keywords"
								name="keywords" />
							<span class="input-notification information png_bg">专题的关键字
								信息</span>
							<br />
						</p>
						<p>
							<label>
								专题来源：
							</label>
							<select name="source" id="source">
								<option value="原创">
									原创
								</option>
								<option value="转载">
									转载
								</option>
							</select>
							<br />
						</p>
						<p>
							<label style="color: red;">
								专题所属大类别：
							</label>
							<select name="typename" id="typename">
								<c:forEach var="at" items="${requestScope.ArticleType}">
									<option value="${at.articleTypeName}">
										${at.articleTypeName}
									</option>
								</c:forEach>
							</select>
							<span class="input-notification attention png_bg">专题所属主类，如：科技、时尚等</span>
							<br />
						</p>

						<p>
							<label style="color: red;">
								专题所属小类别：
							</label>
							<select name="stylename" id="stylename">
								<c:forEach var="as" items="${requestScope.ARTICLESTYLE}">
									<option value="${as.articleStyleName}">
										${as.articleStyleName}
									</option>
								</c:forEach>

							</select>
							<span class="input-notification attention png_bg">专题所属支类，如：IT,生物等</span>
							<br />
						</p>

						<p>
							<label style="color: red;">
								专题所属标识：
							</label>
							<select name="topicimg"
								onChange="document.images['avatar'].src=options[selectedIndex].value;">
								<c:forEach var="as" items="${requestScope.ARTICLESTYLE}">
									<option value="${ctx}${as.articleStyleImage}">
										${as.articleStyleName}
									</option>
								</c:forEach>
							</select>
							<img id="avatar" src="${ctx}\images\icon4.png" width="50"
								height="50" />
							<span class="input-notification attention png_bg">专题类型图标</span>
							<br />
						</p>

						<p>
							<label style="color: red;">
								专题状态：
							</label>
							<select name="status" id="status">
								<option value="0">
									是
								</option>
								<option value="1">
									否
								</option>
							</select>
							<span class="input-notification attention png_bg">是否在首页显示</span>
							<br />
						</p>

						<p>
							<label style="color: red;">
								上传图片:
							</label>
							<input id="topicFile" type="file" name="myFile" />
							<br />
						</p>

						<p>
							<label>
								专题描述：
							</label>
							<input class="text-input Medium-input" type="text" id="describe"
								name="describe" />
							<br />
						</p>

						<p>
							<label style="color: red;">
								专题摘要：
							</label>
							<textarea cols="60" id="editor1" name="summary" rows="8"></textarea>
							<br />
						</p>

						<p>
							<label style="color: red;">
								专题内容：
							</label>
							<textarea cols="60" id="editor2" name="content" rows="8"></textarea>
							<br />
						</p>
						<p>
							<input class="button" type="submit" value="保存" />
						</p>
					</form>

					<div class="clear"></div>
					<!-- End .clear -->

				</div>
				<!-- End #tab2 -->
			</div>
			<!-- End .content-box-content -->
		</div>
		<!-- End .content-box -->
		<jsp:include page="foot.jsp" flush="true"></jsp:include>
		<ckeditor:replaceAll basePath="${ctx}/ckeditor/" />
		<!--<ckeditor:replace replace="editor1" basePath="${ctx}/ckeditor/" />-->
	</body>
</html>
